package net.pm.core.entities.db;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import net.pm.core.entities.PMCommandEntity;

import org.hibernate.annotations.GenericGenerator;


/**
 * The persistent class for the loginlog database table.
 * 
 */
@Entity
@Table(name="loginlog")
public class Loginlog extends PMCommandEntity<Loginlog>{
	private static final long serialVersionUID = 3339675381057946506L;
	private String id;
	private String loginIP;
	private Date loginTime;
	private Short logResult;
	private Pmuser pmuser;
	
	
	public static final Short logResult_account_disable = Short.valueOf("0").shortValue();
	public static final Short logResult_passwd_error = Short.valueOf("1").shortValue();
	public static final Short logResult_login_success = Short.valueOf("2").shortValue();
	
	/**
	 * 默认显示登录失败的记录
	 */
	public static final Short LOGRESULT_DEFAULT_DISPLAY = Short.valueOf("3").shortValue();
	/**
	 * 显示全部的订单状态
	 */
	public static final Short LOGRESULT_ALL_DISPLAY = Short.valueOf("4").shortValue();
	
	
	
    public Loginlog() {
    }

	public Loginlog(String id) {
		super();
		this.id = id;
	}

	@Id
	@GenericGenerator(name = "generator", strategy = "org.hibernate.id.UUIDGenerator")
	@GeneratedValue(generator = "generator")
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name="loginIP",nullable=false)
	public String getLoginIP() {
		return this.loginIP;
	}

	public void setLoginIP(String loginIP) {
		this.loginIP = loginIP;
	}


    @Temporal( TemporalType.TIMESTAMP)
    @Column(nullable=false)
	public Date getLoginTime() {
		return this.loginTime;
	}

	public void setLoginTime(Date loginTime) {
		this.loginTime = loginTime;
	}

	@Column(name="logResult",nullable=false)
	public Short getLogResult() {
		return this.logResult;
	}

	public void setLogResult(Short logResult) {
		this.logResult = logResult;
	}


	//bi-directional many-to-one association to Pmuser
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="UserId")
	public Pmuser getPmuser() {
		return this.pmuser;
	}

	public void setPmuser(Pmuser pmuser) {
		this.pmuser = pmuser;
	}


	@Override
	public int compareTo(Loginlog o) {
		// TODO Auto-generated method stub
		return 0;
	}
	
}